<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
    <script src="./vue.js"></script>
    <style></style>
  </head>
  <body>
    <div id="app">
      <!-- 只允许输入数字 -->
      <input type="text" v-model="word" @input="input" />
    </div>
  </body>
  <script>
    let app = Vue.createApp({
      data() {
        return {
          word: "",
        };
      },
      methods: {
        input() {
          this.word = this.word.replace(/\D/, "");
        },
      },
    });
    app = app.mount("#app");
  </script>
</html>
